#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
using namespace std;
bool cmpv(int a,int b){
    return a<b;
}
bool cmpbylenth(string a,string b){
    return a.length()<b.length();
}
int main(){
    vector<int> v;
    string str[3]={"hello","world","my"};
    v.push_back(3);
    v.push_back(1);
    v.push_back(2);
    //1.vector
    sort(v.begin(),v.end(),cmpv);
    for(int i=0;i<3;i++){
        printf("%d ",v[i]);
    }
    printf("\n");
    //2.string
    sort(str,str+3);
    for (int i = 0; i < 3; i++){
        cout<<str[i]<<" ";
    }
    printf("\n");
    //3.stringlenth
    sort(str,str+3,cmpbylenth);
    for (int i = 0; i < 3; i++){
        cout<<str[i]<<" ";
    }
    printf("\n");
    return 0;
}
/*
    只有vector ，string ,deque 可以使用sort
    printf+%s不能输出string类型的数据，要使用cout
*/ 

